package com.weasel.weixin.commons.message.builder;

import com.weasel.weixin.commons.message.bean.WeiXinPostCommonXmlAnswerVideoMessage;

/**
 * Created by Dylan on 2015/10/12.
 */
public class WeixinPostCommonXmlAnswerVideoMessageBuilder extends AbstractWeixinPostCommonXmlAnswerMessageBuilder<WeixinPostCommonXmlAnswerVideoMessageBuilder,WeiXinPostCommonXmlAnswerVideoMessage>{

    public WeixinPostCommonXmlAnswerVideoMessageBuilder() {
        super(new WeiXinPostCommonXmlAnswerVideoMessage());
    }


    public WeixinPostXmlAnswerArticleBodyMessageBuilder addVideo(){

        return new WeixinPostXmlAnswerArticleBodyMessageBuilder(this);
    }

    public static class WeixinPostXmlAnswerArticleBodyMessageBuilder{

        private WeixinPostCommonXmlAnswerVideoMessageBuilder parent = null;

        private WeiXinPostCommonXmlAnswerVideoMessage.VideoBody body = new WeiXinPostCommonXmlAnswerVideoMessage.VideoBody();

        public WeixinPostXmlAnswerArticleBodyMessageBuilder(){
        }
        public WeixinPostXmlAnswerArticleBodyMessageBuilder(WeixinPostCommonXmlAnswerVideoMessageBuilder _parent){

            this.parent = _parent;
        }

        public WeixinPostXmlAnswerArticleBodyMessageBuilder title(String title){

            body.setTitle(title);
            return this;
        }

        public WeixinPostXmlAnswerArticleBodyMessageBuilder description(String description){

            body.setDescription(description);
            return this;
        }

        public WeixinPostXmlAnswerArticleBodyMessageBuilder mediaId(String mediaId){

            body.setMediaId(mediaId);
            return this;
        }

        public WeixinPostCommonXmlAnswerVideoMessageBuilder end(){

            if(null == parent){
                throw new RuntimeException("请调用带参的构造方法，并传递WeixinPostCommonXmlAnswerImageMessageBuilder参数，否则请调用build方法");
            }
            ((WeiXinPostCommonXmlAnswerVideoMessage)parent.message).setVideo(build());
            return parent;
        }


        public WeiXinPostCommonXmlAnswerVideoMessage.VideoBody build(){
            return body;
        }

    }
}
